LanguageExt.Core

LanguageExt.Core Immutable Collections BiMap

Contents

struct BiMap <A, B> Source #

Map type indexed both on the A and B for rapid lookup of either

Parameters

type A

A

type B

B

Indexers

this [ A ] Source #

'this' accessor

Parameters

param key

Key

returns

value

this [ B ] Source #

'this' accessor

Parameters

param key

Key

returns

value

Properties

property bool IsEmpty Source #

Is the map empty

property int Count Source #

Number of items in the map

property int Length Source #

Alias of Count

property EnumerableM<A> LeftKeys Source #

Enumerable of map lefts in-order

property EnumerableM<B> RightKeys Source #

Enumerable of map rights in-order

property EnumerableM<B> LeftValues Source #

Enumerable of map lefts in-rights-order

property EnumerableM<A> RightValues Source #

Enumerable of map rights in-lefts-order

property EnumerableM<(A Key, B Value)> Tuples Source #

Enumerable of in-order tuples that make up the map

Parameters

returns

Tuples

property EnumerableM<(A Key, B Value)> Pairs Source #

Enumerable of in-order tuples that make up the map

Parameters

returns

Tuples

Constructors

constructor BiMap (IEnumerable<(A Left, B Right)> items) Source #

constructor BiMap (IEnumerable<(A Left, B Right)> items, bool tryAdd) Source #

Methods

method BiMap<A, B> Add (A left, B right) Source #

Atomically adds a new item to the map

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method BiMap<A, B> TryAdd (A left, B right) Source #

Atomically adds a new item to the map. If the key already exists, then the new item is ignored

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method BiMap<A, B> AddRange (IEnumerable<(A, B)> range) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method BiMap<A, B> AddRange (IEnumerable<Tuple<A, B>> range) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method BiMap<A, B> AddRange (IEnumerable<KeyValuePair<A, B>> range) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method BiMap<A, B> TryAddRange (IEnumerable<(A, B)> range) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method BiMap<A, B> TryAddRange (IEnumerable<Tuple<A, B>> range) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method BiMap<A, B> TryAddRange (IEnumerable<KeyValuePair<A, B>> range) Source #

Atomically adds a range of items to the map.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method BiMap<A, B> AddOrUpdateRange (IEnumerable<Tuple<A, B>> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method BiMap<A, B> AddOrUpdateRange (IEnumerable<(A, B)> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Null is not allowed for a Key or a Value

Parameters

param range

Range of tuples to add

returns

New Map with the items added

method BiMap<A, B> AddOrUpdateRange (IEnumerable<KeyValuePair<A, B>> range) Source #

Atomically adds a range of items to the map. If any of the keys exist already then they're replaced.

Null is not allowed for a Key or a Value

Parameters

param range

Range of KeyValuePairs to add

returns

New Map with the items added

method BiMap<A, B> Remove (A left) Source #

Atomically removes an item from the map If the key doesn't exists, the request is ignored.

Parameters

param key

Key

returns

New map with the item removed

method BiMap<A, B> Remove (B right) Source #

Atomically removes an item from the map If the key doesn't exists, the request is ignored.

Parameters

param key

Key

returns

New map with the item removed

method BiMap<A, B> SetItem (A left, B right) Source #

Atomically updates an existing item

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method BiMap<A, B> TrySetItem (A left, B right) Source #

Atomically updates an existing item, unless it doesn't exist, in which case it is ignored

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method BiMap<A, B> AddOrUpdate (A left, B right) Source #

Atomically adds a new item to the map. If the key already exists, the new item replaces it.

Null is not allowed for a Key or a Value

Parameters

param key

Key

param value

Value

returns

New Map with the item added

method bool ContainsKey (A value) Source #

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method bool ContainsKey (B value) Source #

Checks for existence of a key in the map

Parameters

param key

Key to check

returns

True if an item with the key supplied is in the map

method BiMap<A, B> Clear () Source #

Clears all items from the map

Functionally equivalent to calling Map.empty as the original structure is untouched

Parameters

returns

Empty map

method IReadOnlyDictionary<A, B> ToDictionaryLeft () Source #

Convert the map to an IReadOnlyDictionary

Parameters

returns

method IReadOnlyDictionary<B, A> ToDictionaryRight () Source #

Convert the map to an IReadOnlyDictionary

Parameters

returns

method Seq<(A Key, B Value)> ToSeq () Source #

method bool Equals (BiMap<A, B> y) Source #

method Option<B> Find (A value) Source #

method Option<A> Find (B value) Source #

method MapEnumerator<A, B> GetEnumerator () Source #

method int CompareTo (BiMap<A, B> rhs) Source #

method int CompareTo (object? obj) Source #

method bool Equals (object? obj) Source #

method int GetHashCode () Source #

Operators

operator == (BiMap<A, B> lhs, BiMap<A, B> rhs) Source #

operator != (BiMap<A, B> lhs, BiMap<A, B> rhs) Source #

operator < (BiMap<A, B> lhs, BiMap<A, B> rhs) Source #

operator <= (BiMap<A, B> lhs, BiMap<A, B> rhs) Source #

operator > (BiMap<A, B> lhs, BiMap<A, B> rhs) Source #

operator >= (BiMap<A, B> lhs, BiMap<A, B> rhs) Source #

operator + (BiMap<A, B> lhs, BiMap<A, B> rhs) Source #

operator - (BiMap<A, B> lhs, BiMap<A, B> rhs) Source #